<%@ page import="com.rihel.dao.GoodsDao" %>
<%@ page import="com.rihel.model.Goods" %>
<%@ page import="java.util.ArrayList" %><%--
  Created by IntelliJ IDEA.
  User: rihel
  Date: 2018/3/14
  Time: 下午8:38
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="includes/head.jsp"%>

<div class="container">
    <div class="row">
        <div class="col-12">
            <div class="jumbotron">
                <h1>商品列表</h1>
            </div>
        </div>
    </div>
    <div class="row">
        <%
            GoodsDao goodsDao = new GoodsDao();
            ArrayList<Goods> goodsList = goodsDao.getAllGoods();
            for (Goods good:goodsList) {
        %>
        <div class="col-md-3" style="margin-top: 20px;">
            <div class="card">
                <a  href="<%="goods.jsp?id="+good.getId()%>">
                    <img class="card-img-top" src="<%=good.getPicUrl()%>" alt="">
                </a>
                <div class="card-body">
                    <h3 class="card-title">
                        <a href="<%="goods.jsp?id="+good.getId()%>" > <%=good.getName()%></a>
                    </h3>
                    <p class="card-text">
                        <span class="badge badge-success">价格：￥<span class="h2"><%=good.getPrice()%></span></span>
                    </p>
                    <a  class="btn btn-primary" href="<%="goods.jsp?id="+good.getId()%>">
                        查看详情
                    </a>
                    <a  class="btn btn-info " href="<%="cart?redirect=index.jsp&action=add&goods_id="+good.getId()%>">
                        <i class="fa fa-shopping-cart"></i>
                        加入购物车
                    </a>
                </div>
            </div>
        </div>
        <%}%>
    </div>
</div>
<%@ include file="includes/foot.jsp"%>


